package com.unionbigdata.teaching.constant;

import lombok.Getter;

@Getter
public enum ServiceStateEnum {

    NOT_DEPLOYED(0, "未部署"),
    RUNNING(1,"运行中"),
    STOP(2,"已停止"),
    ;
    private final Integer status;

    private final String desc;

    ServiceStateEnum(Integer status, String desc){
        this.status = status;
        this.desc = desc;
    }

    public static String getDescByStatus(Integer status) {
        if (status == null) {
            return "未知状态";
        }
        for (ServiceStateEnum value : ServiceStateEnum.values()) {
            if (value.getStatus().equals(status)) {
                return value.getDesc();
            }
        }
        return "未知状态"; // 默认返回值
    }
}